<?php use_helper('Date'); ?>
<?php $prj_id = sfContext::getInstance()->getUser()->getAttribute('prj_id', '') ?>
<h1>
<?php 
	if ($sf_request->getParameter('action') == 'index') {
		echo "Tâches en cours";
	} else
		echo "Toutes les tâches";
?> 
</h1>



<div class="section">
<table class="detail">
	<tr>
		<th>Tâches en cours</th>
		<td><?php echo TacheTable::getNbTachesEnCours($prj_id) ?></td>
	</tr>
	<tr>
		<th>Tâches en retard</th>
		<td>
		<?php 
			$nb = TacheTable::getNbTachesEnRetard($prj_id);
			if ($nb > 0) {
				echo '<span class="alerte">';
				echo $nb;
				echo '</span>';
			} else {
				echo $nb;
			}
		?>
		</td>
	</tr>
	<tr>
		<th>Charge restante estimée</th>
		<td>
		<?php 
			$charge = 0;
			foreach ($tache_list as $tache) {
				$charge += $tache->getTacChargeRestante();
			}
			echo $charge;
		?>
		</td>
	</tr>
</table>
</div>



<div class="action">
<?php
	if ($sf_request->getParameter('action') == 'index')
		echo link_to('Toutes les tâches', 'tache/all', array('class' => 'action'));
	else
		echo link_to('Tâches en cours', 'tache/index', array('class' => 'action'));

?>
&nbsp;
<?php echo link_to('Nouvelle tâche', 'tache/new', array('class' => 'action')) ?>
</div>

<?php include('liste.php'); ?>
